#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    string a[] = {"Sunday", "Monday", "Tuesday", "Wednesday","Thursday", "Friday", "Saturday"};;
    int repeat;
    cin>>repeat;
    for(int i = 0; i<repeat; i++)
    {
        string input;
        cin>>input;
        
        bool ifFind = false;
        for(int j = 0; j<7; j++)
        {
            if(a[j] == input)
            {
                ifFind = true;
                cout<<j+1<<endl;
                break;
            }
        }
        if(!ifFind)
            cout<<-1<<endl;
        
     }
}